import wx

import time
from DataManager import DataManager
from SimpleDialogs import DialogAddItem
from SimpleMenus import TodoListPopupMenu
from ControlBaseList import ControlBaseList

class ControlTodoList(ControlBaseList):
    @classmethod
    def get_model(cls):
        return DataManager.todolist

    @classmethod
    def control_list_right_click(cls, self, evt):
        #use base class to handle routines#TODO:todo list need a new popup menu
        action, pos = ControlBaseList.control_list_right_click(self, evt, TodoListPopupMenu)
        item = self.data_list[pos]
        if action[0] == "DELETE":
            DataManager.todolist.delete(item)
        elif action[0] != "DO_NOTHING":
            #move = delete + add to another place
            DataManager.todolist.delete(item)
            cls.control_move_to_other_list(item, action[0])

    @classmethod
    def control_list_double_click(cls, self, evt):
        #use base class to handle routines
        ret, d, r = ControlBaseList.control_list_double_click(self, evt)
        if r != 0:
            #cancel case
            pass
        else:
            model = cls.get_model()
            #model.delete(d)
            #i = model.build_append(ret)
            model.modify(d, ret)
